package com.作业.Day7;

import java.util.Scanner;

public class Homework3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("宝马");
            System.out.println("别克林");
            System.out.println("五菱红光");
            System.out.println("金龙");
            System.out.println("大卡车");
            System.out.println("小卡车");
            System.out.println("请选择你想要的汽车种类");
            int i = scanner.nextInt();
            System.out.println("数量");
            int num = scanner.nextInt();
            System.out.println("天数");
            int days = scanner.nextInt();
            MotosVehile[] motosVehiles = new MotosVehile[num];
            switch (i) {
                case 1:
                    for (int j = 0; j < num; j++) {
                        motosVehiles[j]=new Car("宝马", "宝马");
                    }
                    break;
                case 2:
                    for (int j = 0; j < num; j++) {
                        motosVehiles[i]=new Car("别克林", "宝马");
                    }
                    break;
                case 3:
                    for (int j = 0; j < num; j++) {
                        motosVehiles[i]=new Car("五菱红光", "宝马");
                    }
                    break;
                case 4:
                    for (int j = 0; j < num; j++) {
                        motosVehiles[i]=new Bus("金龙", 60);
                    }
                    break;
                    case 5:
                        for (int j = 0; j < num; j++) {
                            motosVehiles[i]=new truck("大卡车");
                        }
                        break;
                        case 6:
                            for (int j = 0; j < num; j++) {
                                motosVehiles[i] = new truck("小卡车");
                            }
                            break;
            }
            int i1 = Homework2.calcTotalRent(motosVehiles, days);
            System.out.println(i1);
        }
    }
}

class truck extends MotosVehile {
    public truck(String name) {
        super(name);
    }

    @Override
    int calRent(int days) {
        int a = 0;
        int sum = 0;
        if (this.name.equals("大卡车"))
            a = 100;
        else
            a = 200;
        for (int i = 0; i < days; i++) {
            sum += days * a;
        }
        return sum;
    }
}